// excerpts from http://code.google.com/p/muduo/
//
// Use of this source code is governed by a BSD-style license
// that can be found in the License file.
//
// Author: Shuo Chen (chenshuo at chenshuo dot com)

#ifndef MUDUO_NET_CALLBACKS_H
#define MUDUO_NET_CALLBACKS_H

#include <boost/function.hpp>
#include <boost/shared_ptr.hpp>

#include "datetime/Timestamp.h"

namespace learnmuduo
{

// All client visible callbacks go here.

class TcpConnection;
typedef boost::shared_ptr<TcpConnection> TcpConnectionPtr; // 智能指针别名，便于在回调里共享连接对象。

typedef boost::function<void()> TimerCallback; // 定时器回调，参数为空
typedef boost::function<void (const TcpConnectionPtr&)> ConnectionCallback; // 连接建立/断开时触发的回调。
typedef boost::function<void (const TcpConnectionPtr&,
                              const char* data,
                              ssize_t len)> MessageCallback; // 收到消息时触发的回调，参数包括连接和到达时间戳。

}

#endif  // MUDUO_NET_CALLBACKS_H
